package Huihu.src.TcpandUdp;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class UdpClient {
    public static void main(String[] args) throws Exception {
        DatagramSocket socket=new DatagramSocket();
        String str="中国你好";
        InetAddress inetAddress=InetAddress.getByName("127.0.0.1");
        int port=6655;
        DatagramPacket packet=new DatagramPacket(str.getBytes(),0,str.getBytes().length,inetAddress,port);
        socket.send(packet);
        socket.close();
    }
}
